#ifndef  SIMPLESEQUENCEREADER_H
#define  SIMPLESEQUENCEREADER_H


#include <memory>
#include "recovery/Status.h"

class Topic;

namespace recovery {
namespace fs {
namespace file {
	class FileRandomReader;
}
}
}

class SimpleSequenceReader {
public:
	explicit SimpleSequenceReader(Topic & topic);
	~SimpleSequenceReader();
	// =0 -> OK; wait ok
    // >0 -> available; 
    // <0 -> error
	int polling(size_t ms);
	recovery::Status read(unsigned char * buf, const size_t size, size_t & readBytes);
	bool open();
	bool close();

private:
	Topic & _topic;
    std::unique_ptr<recovery::fs::file::FileRandomReader> _reader;
    size_t _readBytes = 0;
};

#endif   /* SIMPLESEQUENCEREADER_H */
